package com.yuebao.model.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 流水表
 * @TableName transaction
 */
@TableName(value ="transaction")
@Data
public class Transaction implements Serializable {
    /**
     *
     */
    @TableId(value = "transaction_id")
    private Long transactionId;

    /**
     * 描述
     */
    @TableField(value = "item_description")
    private String itemDescription;

    /**
     * 订单产生时间
     */
    @TableField(value = "order_time")
    private String orderTime;

    /**
     * 订单号
     */
    @TableField(value = "order_NO")
    private Long orderNo;

    /**
     * 订单状态
     */
    @TableField(value = "order_state")
    private String orderState;

    /**
     * 申购/赎回金额
     */
    @TableField(value = "trade_money")
    private BigDecimal tradeMoney;

    /**
     * 用户UUID
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 基金产品
     */
    @TableField(value = "fund_id")
    private Long fundId;

    /**
     * 交易分类
     */
    @TableField(value = "trans_category")
    private String transCategory;

    /**
     * 记录描述
     */
    @TableField(value = "labels_notes")
    private String labelsNotes;

    /**
     * 购买份额
     */
    @TableField(value = "share")
    private BigDecimal share;

    /**
     *
     */
    @TableField(value = "is_deleted")
    private Integer isDeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Transaction other = (Transaction) that;
        return (this.getTransactionId() == null ? other.getTransactionId() == null : this.getTransactionId().equals(other.getTransactionId()))
            && (this.getItemDescription() == null ? other.getItemDescription() == null : this.getItemDescription().equals(other.getItemDescription()))
            && (this.getOrderTime() == null ? other.getOrderTime() == null : this.getOrderTime().equals(other.getOrderTime()))
            && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
            && (this.getOrderState() == null ? other.getOrderState() == null : this.getOrderState().equals(other.getOrderState()))
            && (this.getTradeMoney() == null ? other.getTradeMoney() == null : this.getTradeMoney().equals(other.getTradeMoney()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getFundId() == null ? other.getFundId() == null : this.getFundId().equals(other.getFundId()))
            && (this.getTransCategory() == null ? other.getTransCategory() == null : this.getTransCategory().equals(other.getTransCategory()))
            && (this.getLabelsNotes() == null ? other.getLabelsNotes() == null : this.getLabelsNotes().equals(other.getLabelsNotes()))
            && (this.getShare() == null ? other.getShare() == null : this.getShare().equals(other.getShare()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTransactionId() == null) ? 0 : getTransactionId().hashCode());
        result = prime * result + ((getItemDescription() == null) ? 0 : getItemDescription().hashCode());
        result = prime * result + ((getOrderTime() == null) ? 0 : getOrderTime().hashCode());
        result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
        result = prime * result + ((getOrderState() == null) ? 0 : getOrderState().hashCode());
        result = prime * result + ((getTradeMoney() == null) ? 0 : getTradeMoney().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getFundId() == null) ? 0 : getFundId().hashCode());
        result = prime * result + ((getTransCategory() == null) ? 0 : getTransCategory().hashCode());
        result = prime * result + ((getLabelsNotes() == null) ? 0 : getLabelsNotes().hashCode());
        result = prime * result + ((getShare() == null) ? 0 : getShare().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", transactionId=").append(transactionId);
        sb.append(", itemDescription=").append(itemDescription);
        sb.append(", orderTime=").append(orderTime);
        sb.append(", orderNo=").append(orderNo);
        sb.append(", orderState=").append(orderState);
        sb.append(", tradeMoney=").append(tradeMoney);
        sb.append(", userId=").append(userId);
        sb.append(", fundId=").append(fundId);
        sb.append(", transCategory=").append(transCategory);
        sb.append(", labelsNotes=").append(labelsNotes);
        sb.append(", share=").append(share);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
